package com.onLineCar.manages.pojo.dto;

import cn.hutool.core.bean.BeanUtil;
import com.onLineCar.common.security.utils.SecurityUtils;
import com.onLineCar.manages.pojo.VehicleInfo;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

@Data
public class VehicleInfoDTO {

    private Integer vehicleId;

    /**
     * 归属城市
     */
    @NotNull(message = "归属城市不能为空")
    private Long cityId;

    /**
     * 车辆级别
     */
    @NotNull(message = "车辆级别不能为空")
    private Long vehicleLevelId;

    /**
     * 选择车型
     */
    @NotNull(message = "车型不能为空")
    private Long vehicleTypeId;

    /**
     * 车辆VIN码
     */
    @NotBlank(message = "车辆VIN码不能为空")
    private String vinCode;

    /**
     * 车牌号
     */
    @NotBlank(message = "车牌号不能为空")
    private String licensePlate;

    /**
     * 是否安装车脑，0代表否，1代表是
     */
    @NotNull(message = "车脑不能为空")
    private Integer installedVehicleBrain;

    /**
     * 车脑品牌
     */
    private String vehicleBrainBrand;

    /**
     * 车脑编号
     */
    private String vehicleBrainCode;

    /**
     * 大屏品牌
     */
    @NotNull(message = "大屏品牌不能为空")
    private String largeScreenBrand;

    /**
     * 大屏编号
     */
    @NotNull(message = "大屏编号不能为空")
    private String largeScreenCode;

    /**
     * 车辆状态
     */
    @NotNull(message = "车辆状态不能为空")
    private String vehicleStatus;

    public VehicleInfo convertVehicleInfo(VehicleInfoDTO vehicleInfoDTO){
        VehicleInfo vehicleInfo = new VehicleInfo();
        BeanUtil.copyProperties(vehicleInfoDTO, vehicleInfo);
        vehicleInfo.setCreatedBy(SecurityUtils.getUsername());
        return vehicleInfo;
    }
}
